package com.sun.entity;

public class AccessToken {
	private String token;
	private long expireTime;

	public AccessToken(String token, long expires_in) {
		this.token = token;
		this.expireTime = expires_in*1000 + System.currentTimeMillis();
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public long getExpireTime() {
		return expireTime;
	}

	public void setExpireTime(long expireTime) {
		this.expireTime = expireTime;
	}

	/**
	 * 判断token是否过期
	 * @return
	 */
	public boolean IsExpired(){
		return System.currentTimeMillis()>expireTime;
	}

	@Override
	public String toString() {
		return "AccessToken{" +
				"token='" + token + '\'' +
				", expireTime=" + expireTime +
				'}';
	}
}
